using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections;
using System.Collections.Generic;
using webapp4U.BOL;

namespace webapp4U.DAL
{
    public class VisitorDAL : BaseDAL
    {
        public int Update()
        {
            using (SqlConnection myConn = GetConnectionString())
            {
                SqlCommand myCommand = new SqlCommand("Job_Visitor_Update", myConn);
                myCommand.CommandType = CommandType.StoredProcedure;
                myCommand.ExecuteNonQuery();
                myConn.Close();
                return 1;
            }
        }

        public int GetVisitorNumber()
        {
            using (SqlConnection myConn = GetConnectionString())
            {
                try
                {
                    int value = 0;
                    SqlCommand myCommand = new SqlCommand("Job_Visitor_GetVisitorNumber", myConn);
                    myCommand.CommandType = CommandType.StoredProcedure;
                    value = (int)myCommand.ExecuteScalar();
                    myConn.Close();
                    return value;
                }
                catch { return 0; }
            }

        }

	}
}
